from PyQt5 import QtWidgets
import sys

from views.home import HomeWindow
from models.game import Game
from models.review import Review

# Launcher for the main client
if __name__ == "__main__":
    # Get remote games
    Game.updateRemote()

    # Get a list of games
    games = Game.getAll()

    # Update reviews
    Review.updateRemoteByParent(games)

    # Get a list of reviews
    reviews = Review.getAll()

    app = QtWidgets.QApplication(sys.argv)
    window = HomeWindow(games, reviews)

    # Default game display
    window.gameList.setCurrentRow(0)
    window.gameList.gameClicked(window.gameList.item(0))

    sys.exit(app.exec_())
